/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package org.taobao.ibatiside.model.mapperv2.impl;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

import org.taobao.ibatiside.model.mapperv2.CacheModel;
import org.taobao.ibatiside.model.mapperv2.EnumResultType;
import org.taobao.ibatiside.model.mapperv2.Mapperv2Package;
import org.taobao.ibatiside.model.mapperv2.ResultMap;
import org.taobao.ibatiside.model.mapperv2.Statement;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Statement</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link org.taobao.ibatiside.model.mapperv2.impl.StatementImpl#getCacheModel <em>Cache Model</em>}</li>
 *   <li>{@link org.taobao.ibatiside.model.mapperv2.impl.StatementImpl#getFetchSize <em>Fetch Size</em>}</li>
 *   <li>{@link org.taobao.ibatiside.model.mapperv2.impl.StatementImpl#getRemapResults <em>Remap Results</em>}</li>
 *   <li>{@link org.taobao.ibatiside.model.mapperv2.impl.StatementImpl#getResultClass <em>Result Class</em>}</li>
 *   <li>{@link org.taobao.ibatiside.model.mapperv2.impl.StatementImpl#getResultMap <em>Result Map</em>}</li>
 *   <li>{@link org.taobao.ibatiside.model.mapperv2.impl.StatementImpl#getResultSetType <em>Result Set Type</em>}</li>
 *   <li>{@link org.taobao.ibatiside.model.mapperv2.impl.StatementImpl#getXmlResultName <em>Xml Result Name</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class StatementImpl extends GeneralStatementImpl implements Statement {
	/**
	 * The cached value of the '{@link #getCacheModel() <em>Cache Model</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getCacheModel()
	 * @generated
	 * @ordered
	 */
	protected CacheModel cacheModel;

	/**
	 * The default value of the '{@link #getFetchSize() <em>Fetch Size</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getFetchSize()
	 * @generated
	 * @ordered
	 */
	protected static final Integer FETCH_SIZE_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getFetchSize() <em>Fetch Size</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getFetchSize()
	 * @generated
	 * @ordered
	 */
	protected Integer fetchSize = FETCH_SIZE_EDEFAULT;

	/**
	 * The default value of the '{@link #getRemapResults() <em>Remap Results</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getRemapResults()
	 * @generated
	 * @ordered
	 */
	protected static final Boolean REMAP_RESULTS_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getRemapResults() <em>Remap Results</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getRemapResults()
	 * @generated
	 * @ordered
	 */
	protected Boolean remapResults = REMAP_RESULTS_EDEFAULT;

	/**
	 * The default value of the '{@link #getResultClass() <em>Result Class</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getResultClass()
	 * @generated
	 * @ordered
	 */
	protected static final String RESULT_CLASS_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getResultClass() <em>Result Class</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getResultClass()
	 * @generated
	 * @ordered
	 */
	protected String resultClass = RESULT_CLASS_EDEFAULT;

	/**
	 * The cached value of the '{@link #getResultMap() <em>Result Map</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getResultMap()
	 * @generated
	 * @ordered
	 */
	protected ResultMap resultMap;

	/**
	 * The default value of the '{@link #getResultSetType() <em>Result Set Type</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getResultSetType()
	 * @generated
	 * @ordered
	 */
	protected static final EnumResultType RESULT_SET_TYPE_EDEFAULT = EnumResultType.SCROLLINSENSITIVE;

	/**
	 * The cached value of the '{@link #getResultSetType() <em>Result Set Type</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getResultSetType()
	 * @generated
	 * @ordered
	 */
	protected EnumResultType resultSetType = RESULT_SET_TYPE_EDEFAULT;

	/**
	 * This is true if the Result Set Type attribute has been set.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 * @ordered
	 */
	protected boolean resultSetTypeESet;

	/**
	 * The default value of the '{@link #getXmlResultName() <em>Xml Result Name</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getXmlResultName()
	 * @generated
	 * @ordered
	 */
	protected static final String XML_RESULT_NAME_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getXmlResultName() <em>Xml Result Name</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getXmlResultName()
	 * @generated
	 * @ordered
	 */
	protected String xmlResultName = XML_RESULT_NAME_EDEFAULT;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected StatementImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return Mapperv2Package.Literals.STATEMENT;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public CacheModel getCacheModel() {
		return cacheModel;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setCacheModel(CacheModel newCacheModel) {
		CacheModel oldCacheModel = cacheModel;
		cacheModel = newCacheModel;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Mapperv2Package.STATEMENT__CACHE_MODEL, oldCacheModel, cacheModel));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Integer getFetchSize() {
		return fetchSize;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setFetchSize(Integer newFetchSize) {
		Integer oldFetchSize = fetchSize;
		fetchSize = newFetchSize;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Mapperv2Package.STATEMENT__FETCH_SIZE, oldFetchSize, fetchSize));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Boolean getRemapResults() {
		return remapResults;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setRemapResults(Boolean newRemapResults) {
		Boolean oldRemapResults = remapResults;
		remapResults = newRemapResults;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Mapperv2Package.STATEMENT__REMAP_RESULTS, oldRemapResults, remapResults));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getResultClass() {
		return resultClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setResultClass(String newResultClass) {
		String oldResultClass = resultClass;
		resultClass = newResultClass;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Mapperv2Package.STATEMENT__RESULT_CLASS, oldResultClass, resultClass));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ResultMap getResultMap() {
		return resultMap;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setResultMap(ResultMap newResultMap) {
		ResultMap oldResultMap = resultMap;
		resultMap = newResultMap;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Mapperv2Package.STATEMENT__RESULT_MAP, oldResultMap, resultMap));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EnumResultType getResultSetType() {
		return resultSetType;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setResultSetType(EnumResultType newResultSetType) {
		EnumResultType oldResultSetType = resultSetType;
		resultSetType = newResultSetType == null ? RESULT_SET_TYPE_EDEFAULT : newResultSetType;
		boolean oldResultSetTypeESet = resultSetTypeESet;
		resultSetTypeESet = true;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Mapperv2Package.STATEMENT__RESULT_SET_TYPE, oldResultSetType, resultSetType, !oldResultSetTypeESet));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void unsetResultSetType() {
		EnumResultType oldResultSetType = resultSetType;
		boolean oldResultSetTypeESet = resultSetTypeESet;
		resultSetType = RESULT_SET_TYPE_EDEFAULT;
		resultSetTypeESet = false;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.UNSET, Mapperv2Package.STATEMENT__RESULT_SET_TYPE, oldResultSetType, RESULT_SET_TYPE_EDEFAULT, oldResultSetTypeESet));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean isSetResultSetType() {
		return resultSetTypeESet;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getXmlResultName() {
		return xmlResultName;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setXmlResultName(String newXmlResultName) {
		String oldXmlResultName = xmlResultName;
		xmlResultName = newXmlResultName;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Mapperv2Package.STATEMENT__XML_RESULT_NAME, oldXmlResultName, xmlResultName));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case Mapperv2Package.STATEMENT__CACHE_MODEL:
				return getCacheModel();
			case Mapperv2Package.STATEMENT__FETCH_SIZE:
				return getFetchSize();
			case Mapperv2Package.STATEMENT__REMAP_RESULTS:
				return getRemapResults();
			case Mapperv2Package.STATEMENT__RESULT_CLASS:
				return getResultClass();
			case Mapperv2Package.STATEMENT__RESULT_MAP:
				return getResultMap();
			case Mapperv2Package.STATEMENT__RESULT_SET_TYPE:
				return getResultSetType();
			case Mapperv2Package.STATEMENT__XML_RESULT_NAME:
				return getXmlResultName();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case Mapperv2Package.STATEMENT__CACHE_MODEL:
				setCacheModel((CacheModel)newValue);
				return;
			case Mapperv2Package.STATEMENT__FETCH_SIZE:
				setFetchSize((Integer)newValue);
				return;
			case Mapperv2Package.STATEMENT__REMAP_RESULTS:
				setRemapResults((Boolean)newValue);
				return;
			case Mapperv2Package.STATEMENT__RESULT_CLASS:
				setResultClass((String)newValue);
				return;
			case Mapperv2Package.STATEMENT__RESULT_MAP:
				setResultMap((ResultMap)newValue);
				return;
			case Mapperv2Package.STATEMENT__RESULT_SET_TYPE:
				setResultSetType((EnumResultType)newValue);
				return;
			case Mapperv2Package.STATEMENT__XML_RESULT_NAME:
				setXmlResultName((String)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case Mapperv2Package.STATEMENT__CACHE_MODEL:
				setCacheModel((CacheModel)null);
				return;
			case Mapperv2Package.STATEMENT__FETCH_SIZE:
				setFetchSize(FETCH_SIZE_EDEFAULT);
				return;
			case Mapperv2Package.STATEMENT__REMAP_RESULTS:
				setRemapResults(REMAP_RESULTS_EDEFAULT);
				return;
			case Mapperv2Package.STATEMENT__RESULT_CLASS:
				setResultClass(RESULT_CLASS_EDEFAULT);
				return;
			case Mapperv2Package.STATEMENT__RESULT_MAP:
				setResultMap((ResultMap)null);
				return;
			case Mapperv2Package.STATEMENT__RESULT_SET_TYPE:
				unsetResultSetType();
				return;
			case Mapperv2Package.STATEMENT__XML_RESULT_NAME:
				setXmlResultName(XML_RESULT_NAME_EDEFAULT);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case Mapperv2Package.STATEMENT__CACHE_MODEL:
				return cacheModel != null;
			case Mapperv2Package.STATEMENT__FETCH_SIZE:
				return FETCH_SIZE_EDEFAULT == null ? fetchSize != null : !FETCH_SIZE_EDEFAULT.equals(fetchSize);
			case Mapperv2Package.STATEMENT__REMAP_RESULTS:
				return REMAP_RESULTS_EDEFAULT == null ? remapResults != null : !REMAP_RESULTS_EDEFAULT.equals(remapResults);
			case Mapperv2Package.STATEMENT__RESULT_CLASS:
				return RESULT_CLASS_EDEFAULT == null ? resultClass != null : !RESULT_CLASS_EDEFAULT.equals(resultClass);
			case Mapperv2Package.STATEMENT__RESULT_MAP:
				return resultMap != null;
			case Mapperv2Package.STATEMENT__RESULT_SET_TYPE:
				return isSetResultSetType();
			case Mapperv2Package.STATEMENT__XML_RESULT_NAME:
				return XML_RESULT_NAME_EDEFAULT == null ? xmlResultName != null : !XML_RESULT_NAME_EDEFAULT.equals(xmlResultName);
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (fetchSize: ");
		result.append(fetchSize);
		result.append(", remapResults: ");
		result.append(remapResults);
		result.append(", resultClass: ");
		result.append(resultClass);
		result.append(", resultSetType: ");
		if (resultSetTypeESet) result.append(resultSetType); else result.append("<unset>");
		result.append(", xmlResultName: ");
		result.append(xmlResultName);
		result.append(')');
		return result.toString();
	}

} //StatementImpl
